package com.company;

import java.util.Scanner;

public class 妞妞的问题 {
    //默认白是0黑是1
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int T = scanner.nextInt();//1 <= T <= 10000
        Long[][] a = new Long[T][2];

        for(int i = 0; i < T; i++){
            Long m = scanner.nextLong(); Long n = scanner.nextLong();
            Long x0 = scanner.nextLong();Long y0 = scanner.nextLong();
            Long x1 = scanner.nextLong();Long y1 = scanner.nextLong();
            Long x2 = scanner.nextLong();Long y2 = scanner.nextLong();
            Long x3 = scanner.nextLong();Long y3 = scanner.nextLong();

            Long hei = m*n/2;
            Long bai = (m*n)==2?1:hei+1;

            System.out.println("hei is "+hei+", bai is "+bai);

            if((x0%2 == 0 && y0%2 == 0) || (x0%2 == 1 && y0%2 == 1)){//起始位是白色
                //更新第一轮
                Long hei1 = (x1-x0+1)*(y1-y0+1)/2;
                bai += hei1;
                hei -= hei1;
            } else {//起始位是黑色
                System.out.println("黑色e");
                Long bai1 = (x1-x0+1)*(y1-y0+1)/2;
                hei += bai1;
                bai -= bai1;
            }
            System.out.println("hei is "+hei+", bai is "+bai);
            //更新第二轮
            for(Long q = x2; q <= x3; q++) {
                for (Long w = y2; w <= y3; w++) {
                    if (q >= x0 && q <= x1 && w >= y0 && w <= y1) {//在上次的圈里
                        System.out.println("在上次");
                        hei++;
                        bai--;
                    } else {//不在
                        System.out.println("不在");
                        if ((q == 1 && w == 1) || (q % 2 == 0 && w % 2 == 0) || (q % 2 == 1 && w % 2 == 0)) {//白色
                            bai--;
                            hei++;
                        }
                    }
                }
            }
            a[i][0] = hei;
            a[i][1] = bai;
        }
        for (int i = 0; i < a.length; i++){
            System.out.println(a[i][1]+" "+a[i][0]);
        }
    }

}
